80AA3BA0
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
SW	A0,0018 (SP)
SW	A1,001C (SP)
LW	A0,0018 (SP)
JAL	80AA4A0C
OR	A1,R0,R0
LW	A0,0018 (SP)
JAL	80AA49EC	;nothing much: A0->SP+0, A1->SP+4
ADDIU	A1,R0,0001
LUI	V0,80AA
ADDIU	V0,V0,4DF0	;V0=80AA4DF0: p->data following binary
LUI	T6,80AA
LUI	T7,80AA
ADDIU	T6,T6,3D08
ADDIU	T7,T7,3D94
SW	T6,0000 (V0)
SW	T7,0004 (V0)
LUI	T8,80AA
LUI	T9,80AA
LUI	T0,80AA
LUI	T1,80AA
LUI	T2,80AA
LUI	T3,80AA
LUI	T4,80AA
LUI	T5,80AA
LUI	T6,80AA
LUI	T7,80AA
ADDIU	T8,T8,4388
ADDIU	T9,T9,4478
ADDIU	T0,T0,4610
ADDIU	T1,T1,4634
ADDIU	T2,T2,4648
ADDIU	T3,T3,4408
ADDIU	T4,T4,4794
ADDIU	T5,T5,47E8
ADDIU	T6,T6,48A8
ADDIU	T7,T7,4998
SW	T8,0008 (V0)
SW	T9,000C (V0)
SW	T0,0010 (V0)
SW	T1,0014 (V0)
SW	T2,0018 (V0)
SW	T3,001C (V0)
SW	T4,0020 (V0)
SW	T5,0024 (V0)
SW	T6,0028 (V0)
SW	T7,002C (V0)
LUI	AT,8013
SW	V0,6F80 (AT)	;80AA4DF0->80136F80: p->binary variables
LW	RA,0014 (SP)
ADDIU	SP,SP,0018
JR	RA
NOP

80AA3C78
ADDIU	SP,SP,FFE8
LUI	V1,8013
ADDIU	V1,V1,6EA0
SW	RA,0014 (SP)
SW	A0,0018 (SP)
SW	A1,001C (SP)
LW	V0,0098 (V1)
SW	R0,00E0 (V1)
ADDIU	A1,R0,0008
LW	T9,00A8 (V0)
ADDIU	A2,R0,002B
LW	A3,0018 (SP)
JALR	RA,T9
ADDIU	A0,V0,00B0
LUI	V0,8013
LW	V0,6F38 (V0)
ADDIU	A1,R0,0009
ADDIU	A2,R0,0058
LW	T9,00A8 (V0)
LW	A3,0018 (SP)
ADDIU	A0,V0,0454
JALR	RA,T9
NOP
LUI	V0,8013
LW	V0,6F38 (V0)
ADDIU	A1,R0,0008
ADDIU	A2,R0,002B
LW	T9,00A8 (V0)
LW	A3,0018 (SP)
ADDIU	A0,V0,086C
JALR	RA,T9
NOP
LW	RA,0014 (SP)
ADDIU	SP,SP,0018
JR	RA
NOP

80AA3D08	load next 10 credit strings into buffer
ADDIU	SP,SP,FFD8
SW	RA,0024 (SP)
SW	S3,0020 (SP)
SW	S2,001C (SP)
SW	S1,0018 (SP)
SW	S0,0014 (SP)
LUI	T6,8013
LW	T6,6F80 (T6)	;T6=80136F80: p->binary variables
LUI	S1,80AA
ADDIU	S1,S1,4E20	;S1=80AA4E20: binary+30=p->credit buffer
BEQ	T6,R0,80AA3D78	;return if NULL
LUI	S0,80AA
ADDU	S0,S0,A0
LBU	S0,4D54 (S0)	;S0=80AA4D54+A0: p->list of bytes
OR	S2,R0,R0	;S2=0	init.count
ADDIU	S3,R0,000A
ADDIU	S0,S0,04EA	;S0=4EA+value: string_txt ID
//80AA3D4C:	load in next 10 strings
OR	A0,S1,R0	;A0=S1: p->target
ADDIU	A1,R0,000F	;A1=strlen F
JAL	800C3F70	;retrieve string from string_txt
OR	A2,S0,R0	;A2=S0: ID#
ADDIU	S0,S0,0001	;S0++	next ID
SLTI	AT,S0,0558
BNE	AT,R0,80AA3D70	;skip until 558
ADDIU	S2,S2,0001	;S2++	count++
ADDIU	S0,R0,0557	;S0=557: stick it at 557 until further notice
//80AA3D70:
BNE	S2,S3,80AA3D4C	;loop 10 times
ADDIU	S1,S1,000F	;S1+=F: next spot in buffer
//80AA3D78:	return
LW	RA,0024 (SP)
LW	S0,0014 (SP)
LW	S1,0018 (SP)
LW	S2,001C (SP)
LW	S3,0020 (SP)
JR	RA
ADDIU	SP,SP,0028

80AA3D94
ADDIU	SP,SP,FF80
SW	S2,0050 (SP)
SW	S0,0048 (SP)
OR	S0,A1,R0
OR	S2,A2,R0
SW	RA,0054 (SP)
SW	S1,004C (SP)
SW	A0,0090 (SP)
ADDIU	A0,R0,0021
JAL	8008033C
ADDIU	A1,R0,000A
LW	T6,0090 (SP)
BEQ	V0,R0,80AA4054
LW	A0,0000 (T6)
LHU	T7,0002 (V0)
LUI	T9,8013
ANDI	T8,T7,4000
BEQL	T8,R0,80AA4058
LW	RA,0054 (SP)
LW	T9,6F80 (T9)	;T9=80136F80: p->binary variables
LUI	S1,80AA
ADDIU	S1,S1,4E20	;S1=80AA4E20: p->credit buffer
BEQ	T9,R0,80AA4054
ADDIU	A1,R0,0001
JAL	80090F10
SW	A0,0084 (SP)
LUI	T3,80AA
ADDIU	T3,T3,4D54
ADDU	T1,S2,T3
SLTI	AT,S0,0014
LBU	V0,0000 (T1)
BNE	AT,R0,80AA3E24
LBU	T2,0001 (T1)
SLTI	AT,S0,00E0
BNEL	AT,R0,80AA3E30
SLTI	AT,S0,003C
BEQ	R0,R0,80AA3E94
OR	S2,R0,R0
SLTI	AT,S0,003C
BEQ	AT,R0,80AA3E5C
ADDIU	T4,S0,FFEC
MTC1	T4,F4
LUI	AT,40CC
MTC1	AT,F8
CVT.S.W	F6,F4
MUL.S	F10,F6,F8
TRUNC.W.S	F16,F10
MFC1	S2,F16
BEQ	R0,R0,80AA3E94
ANDI	S2,S2,00FF
SLTI	AT,S0,00B8
BNE	AT,R0,80AA3E94
ADDIU	S2,R0,00FF
ADDIU	T6,R0,00DF
SUBU	T7,T6,S0
MTC1	T7,F18
LUI	AT,40CC
MTC1	AT,F6
CVT.S.W	F4,F18
MUL.S	F8,F4,F6
TRUNC.W.S	F10,F8
MFC1	S2,F10
BEQ	R0,R0,80AA3E94
ANDI	S2,S2,00FF
SLT	AT,V0,T2
OR	S0,R0,R0
BEQ	AT,R0,80AA4048
OR	V1,V0,R0
SUBU	T9,V0,T2
ADDIU	T3,T9,000A
MTC1	T3,F16
LUI	AT,4120
MTC1	AT,F4
CVT.S.W	F18,F16
LUI	AT,41F0
MTC1	AT,F8
LUI	AT,80AA
LWC1	F12,4DE0 (AT)
LUI	AT,80AA
MUL.S	F6,F18,F4
LUI	T0,80AA
ADDIU	T0,T0,4D79
LWC1	F2,4DE4 (AT)
ADD.S	F10,F8,F6
SWC1	F10,0058 (SP)
BNE	S0,R0,80AA3F0C
MOV.S	F0,F12
LUI	T4,80AA
ADDIU	T4,T4,4D54
BEQ	T1,T4,80AA3F0C
NOP
MUL.S	F0,F12,F2
BEQ	R0,R0,80AA3F8C
MTC1	S0,F16
LUI	T5,80AA
LBU	T5,4D68 (T5)
LUI	V0,80AA
ADDIU	V0,V0,4D69
BNE	V1,T5,80AA3F2C
NOP
MUL.S	F0,F12,F2
NOP
LBU	T6,0000 (V0)
BNEL	V1,T6,80AA3F44
LBU	T7,0001 (V0)
MUL.S	F0,F0,F2
NOP
LBU	T7,0001 (V0)
BNEL	V1,T7,80AA3F58
LBU	T8,0002 (V0)
MUL.S	F0,F0,F2
NOP
LBU	T8,0002 (V0)
BNEL	V1,T8,80AA3F6C
LBU	T9,0003 (V0)
MUL.S	F0,F0,F2
NOP
LBU	T9,0003 (V0)
ADDIU	V0,V0,0004
BNE	V1,T9,80AA3F80
NOP
MUL.S	F0,F0,F2
NOP
//80AA3F80:
BNEL	V0,T0,80AA3F30
LBU	T6,0000 (V0)
MTC1	S0,F16
LUI	AT,4190
MTC1	AT,F4
CVT.S.W	F18,F16
LWC1	F6,0058 (SP)
ADDIU	T3,R0,00FF
ADDIU	T4,R0,00FF
ADDIU	T5,R0,00FF
ADDIU	T6,R0,0001
MUL.S	F8,F18,F4
ADDIU	T7,R0,0001
SW	T7,0038 (SP)	;SP+38=1: 
SW	T6,002C (SP)	;SP+2C=1: 
SW	T5,001C (SP)	;SP+1C=FF: blue
SW	T4,0018 (SP)	;SP+18=FF: green
SW	T3,0014 (SP)	;SP+14=FF: red
ADD.S	F10,F8,F6
LW	A0,0090 (SP)
OR	A1,S1,R0	;A1=S1: p->credit buffer
ADDIU	A2,R0,000F	;A2=strlen F
SWC1	F10,0010 (SP)
LUI	A3,4316		;A3=150.0: xpos	[43160000]
SW	S2,0020 (SP)	;SP+20=S2: 
SW	R0,0024 (SP)
SW	R0,0028 (SP)
SWC1	F0,0030 (SP)
SWC1	F0,0034 (SP)
SW	V1,007C (SP)
SW	T1,005C (SP)
JAL	80090E1C	;print string A1, size A2 to screen
SW	T2,0080 (SP)
LUI	AT,80AA
LWC1	F2,4DE8 (AT)
LUI	AT,80AA
LW	V1,007C (SP)
ADDIU	S0,S0,0001	;S0++	count++
LWC1	F12,4DEC (AT)
SLTI	AT,S0,000A	;TRUE if 0-9
LUI	T0,80AA
ADDIU	T0,T0,4D79	;T0=80AA4D79: 
LW	T1,005C (SP)
LW	T2,0080 (SP)
//80AA4030:
ADDIU	S1,S1,000F	;S1+=F: p->next string
BEQ	AT,R0,80AA4048
ADDIU	V1,V1,0001
SLT	AT,V1,T2
BNE	AT,R0,80AA3EE8
NOP
//80AA4048:
LW	A0,0084 (SP)
JAL	8009104C
ADDIU	A1,R0,0001
//80AA4054:	return
LW	RA,0054 (SP)
LW	S0,0048 (SP)
LW	S1,004C (SP)
LW	S2,0050 (SP)
JR	RA
ADDIU	SP,SP,0090

80AA406C
SW	A1,0004 (SP)
LH	V0,0000 (A0)
LHU	V1,0006 (A0)
ADDIU	AT,R0,0037
BEQ	V0,R0,80AA40AC
NOP
BEQ	V0,AT,80AA40AC
ADDIU	AT,R0,0021
BEQ	V0,AT,80AA40AC
ORI	AT,R0,D05D
BEQ	V1,AT,80AA40AC
ADDIU	AT,R0,5841
BEQ	V1,AT,80AA40AC
ORI	AT,R0,D06B
BNEL	V1,AT,80AA40B8
LW	T6,0020 (A0)
//80AA40AC:	return 0 if V0 was 37, 21, D05D, 5841, or D06B
JR	RA
OR	V0,R0,R0
//80AA40B4:
LW	T6,0020 (A0)
ADDIU	AT,R0,FFBF
ADDIU	V0,R0,0001
AND	T7,T6,AT
SW	T7,0020 (A0)
JR	RA
NOP

80AA40D0
ADDIU	SP,SP,FFE0
SW	RA,0014 (SP)
SW	A0,0020 (SP)
ADDIU	A0,R0,0021
JAL	8008033C
ADDIU	A1,R0,000A
LW	T6,0020 (SP)
LBU	A0,0946 (T6)
JAL	80AA3D08	;load next 10 credit strings into buffer
SW	V0,001C (SP)
LW	T7,0020 (SP)
LW	V1,001C (SP)
SH	R0,093C (T7)
LHU	T8,0002 (V1)
ORI	T9,T8,4000
SH	T9,0002 (V1)
LW	RA,0014 (SP)
JR	RA
ADDIU	SP,SP,0020

80AA411C
ADDIU	SP,SP,FFE0
SW	RA,0014 (SP)
SW	A0,0020 (SP)
SW	A1,0024 (SP)
ADDIU	A0,R0,0021
JAL	8008033C
ADDIU	A1,R0,000A
SW	V0,001C (SP)
ADDIU	T6,R0,0001
SB	T6,000E (V0)
JAL	8005DE60
ADDIU	A0,R0,0168
JAL	8009944C
LW	A0,0024 (SP)
LW	V1,0020 (SP)
ADDIU	T7,R0,005A
LUI	V0,8013
SH	T7,093C (V1)
LW	V0,6F24 (V0)
BEQL	V0,R0,80AA418C
LW	V0,001C (SP)
LW	T9,0008 (V0)
LW	A0,0000 (V0)
OR	A1,R0,R0
JALR	RA,T9
OR	A2,R0,R0
LW	V1,0020 (SP)
LW	V0,001C (SP)
LUI	AT,FFFF
ORI	AT,AT,80FF
LHU	T8,0002 (V0)
ADDIU	T1,R0,00FF
ADDIU	T2,R0,0078
AND	T0,T8,AT
SH	T0,0002 (V0)
SB	T1,0944 (V1)
SH	R0,0940 (V1)
SH	T2,0000 (V0)
SB	R0,094E (V1)
LW	RA,0014 (SP)
ADDIU	SP,SP,0020
JR	RA
NOP

80AA41C8
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
SW	A0,0018 (SP)
SW	A1,001C (SP)
LUI	T6,8013
LW	T6,6F80 (T6)	;T6=80136F80: p->binary variables
LW	A0,0018 (SP)
LW	T9,0014 (T6)
JALR	RA,T9
NOP
ANDI	A0,V0,00FF
JAL	8005DF80
ADDIU	A1,R0,0168
JAL	8005E530
NOP
LW	T8,0018 (SP)
ADDIU	T7,R0,0400
SW	T7,080C (T8)
JAL	800B1C84	;V0=A0+1C90: p->overlay table
LW	A0,001C (SP)
LW	A0,001C (SP)
OR	A1,V0,R0
LW	A2,0018 (SP)
JAL	800645EC
ADDIU	A3,R0,0005
LW	T1,001C (SP)
LUI	T0,80AA
ADDIU	T0,T0,406C
SW	T0,2208 (T1)
LW	RA,0014 (SP)
ADDIU	SP,SP,0018
JR	RA
NOP

80AA424C
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
SW	A1,001C (SP)
SB	R0,0946 (A0)
JAL	80AA40D0
SW	A0,0018 (SP)
LW	A0,0018 (SP)
SH	R0,093E (A0)
LW	RA,0014 (SP)
JR	RA
ADDIU	SP,SP,0018

80AA4278
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
SW	A1,001C (SP)
JAL	80AA40D0
NOP
LW	RA,0014 (SP)
ADDIU	SP,SP,0018
JR	RA
NOP

80AA429C
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
SW	A1,001C (SP)
LUI	T6,8013
LW	T6,6F80 (T6)	;T6=80136F80: p->binary variables
LW	T9,0014 (T6)
JALR	RA,T9
NOP
ANDI	A0,V0,00FF
JAL	8005E58C
ADDIU	A1,R0,0168
LW	T8,001C (SP)
LUI	T7,800A
ADDIU	T7,T7,AC74
LUI	V0,8013
SW	T7,2208 (T8)
LW	V0,6F24 (V0)
LUI	V1,8013
BEQ	V0,R0,80AA4318
NOP
LBU	V1,62D9 (V1)
LW	T9,0020 (V0)
LW	A0,0000 (V0)
ANDI	A1,V1,00F0
SRA	A1,A1,0x4
ANDI	A2,V1,000F
SLL	A2,A2,0x10
SLL	A1,A1,0x10
SRA	A1,A1,0x10
JALR	RA,T9
SRA	A2,A2,0x10
JAL	8005EAA0
ADDIU	A0,R0,0001
LUI	V0,8013
LW	V0,6F24 (V0)
BEQL	V0,R0,80AA4340
LW	RA,0014 (SP)
LW	T9,001C (V0)
JALR	RA,T9
NOP
LW	RA,0014 (SP)
ADDIU	SP,SP,0018
JR	RA
NOP

80AA434C
ADDIU	SP,SP,FFE0
SW	RA,0014 (SP)
SW	A0,0020 (SP)
SW	A1,0024 (SP)
ADDIU	A0,R0,0021
JAL	8008033C
ADDIU	A1,R0,000A
SW	V0,001C (SP)
JAL	800996CC
LW	A0,0024 (SP)
LW	T6,001C (SP)
SB	R0,000E (T6)
LW	RA,0014 (SP)
JR	RA
ADDIU	SP,SP,0020

80AA4388
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
SLL	T6,A2,0x2
LUI	T9,80AA
ADDU	T9,T9,T6
LW	T9,4D7C (T9)
JALR	RA,T9
NOP
LW	RA,0014 (SP)
ADDIU	SP,SP,0018
JR	RA
NOP

80AA43B8
LBU	V0,0944 (A0)
ADDIU	AT,R0,00FF
BNEL	V0,AT,80AA43E4
MTC1	V0,F8
LWC1	F4,01A8 (A0)
TRUNC.W.S	F6,F4
MFC1	T7,F6
NOP
SB	T7,0944 (A0)
ANDI	V0,T7,00FF
MTC1	V0,F8
LUI	AT,4F80
BGEZ	V0,80AA43FC
CVT.S.W	F10,F8
MTC1	AT,F16
NOP
ADD.S	F10,F10,F16
SWC1	F10,01A8 (A0)
JR	RA
NOP

80AA4408
ADDIU	SP,SP,FFD0
SW	RA,001C (SP)
LWC1	F4,0028 (A0)
LUI	AT,4248
MTC1	AT,F8
SWC1	F4,0024 (SP)
LWC1	F6,002C (A0)
LUI	AT,4220
MTC1	AT,F18
ADD.S	F10,F6,F8
LUI	T7,8013
LW	T7,6EEC (T7)
ADDIU	T6,SP,0024
SWC1	F10,0028 (SP)
LWC1	F16,0030 (A0)
SW	T6,0010 (SP)
ADDIU	A1,R0,0003
ADD.S	F4,F16,F18
ADDIU	A2,R0,0002
OR	A3,R0,R0
SWC1	F4,002C (SP)
LW	T9,00FC (T7)
JALR	RA,T9
NOP
LW	RA,001C (SP)
ADDIU	SP,SP,0030
JR	RA
NOP

80AA4478
ADDIU	SP,SP,FFE0
SW	S0,0018 (SP)
LUI	A3,80AA
ADDIU	A3,A3,4EB8
OR	S0,A0,R0
SW	RA,001C (SP)
SW	A1,0024 (SP)
SW	A2,0028 (SP)
JAL	800FCAD8
OR	A0,A3,R0
LUI	A3,80AA
ADDIU	A3,A3,4EB8
LH	T6,0000 (A3)
ADDIU	AT,R0,0004
BNEL	T6,AT,80AA44E0
LB	T8,0010 (A3)
JAL	80AA43B8
OR	A0,S0,R0
LBU	T7,094E (S0)
BEQL	T7,R0,80AA4600
LW	RA,001C (SP)
JAL	80AA4408
OR	A0,S0,R0
BEQ	R0,R0,80AA4600
LW	RA,001C (SP)
LB	T8,0010 (A3)
SB	T8,071C (S0)
LB	T9,0011 (A3)
BEQL	T9,R0,80AA4510
SB	R0,094E (S0)
JAL	80AA4408
OR	A0,S0,R0
LUI	A3,80AA
ADDIU	T0,R0,0001
ADDIU	A3,A3,4EB8
BEQ	R0,R0,80AA4510
SB	T0,094E (S0)
SB	R0,094E (S0)
MTC1	R0,F4
ADDIU	V1,R0,0003
SWC1	F4,01A4 (S0)
LH	T1,0000 (A3)
BNEL	V1,T1,80AA453C
LB	V0,0012 (A3)
JAL	80AA43B8
OR	A0,S0,R0
BEQ	R0,R0,80AA4600
LW	RA,001C (SP)
LB	V0,0012 (A3)
ADDIU	AT,R0,0004
BEQL	V0,V1,80AA455C
LW	T2,0804 (S0)
BEQL	V0,AT,80AA45B0
LW	T4,0804 (S0)
BEQ	R0,R0,80AA4600
LW	RA,001C (SP)
LW	T2,0804 (S0)
ADDIU	AT,R0,0077
LUI	T3,8013
BEQL	T2,AT,80AA4594
LDC1	F6,0008 (A3)
LW	T3,6EEC (T3)
OR	A0,S0,R0
ADDIU	A1,R0,0077
LW	T9,0104 (T3)
OR	A2,R0,R0
JALR	RA,T9
NOP
LUI	A3,80AA
ADDIU	A3,A3,4EB8
LDC1	F6,0008 (A3)
LUI	AT,4240
MTC1	AT,F10
CVT.S.D	F8,F6
MUL.S	F16,F8,F10
BEQ	R0,R0,80AA45FC
SWC1	F16,01A8 (S0)
LW	T4,0804 (S0)
ADDIU	AT,R0,0076
LUI	T5,8013
BEQL	T4,AT,80AA45E8
LDC1	F18,0008 (A3)
LW	T5,6EEC (T5)
OR	A0,S0,R0
ADDIU	A1,R0,0076
LW	T9,0104 (T5)
OR	A2,R0,R0
JALR	RA,T9
NOP
LUI	A3,80AA
ADDIU	A3,A3,4EB8
LDC1	F18,0008 (A3)
LUI	AT,4280
MTC1	AT,F6
CVT.S.D	F4,F18
MUL.S	F8,F4,F6
SWC1	F8,01A8 (S0)
LW	RA,001C (SP)
LW	S0,0018 (SP)
ADDIU	SP,SP,0020
JR	RA
NOP

80AA4610
LUI	T6,80AA
LH	T6,4EB8 (T6)
OR	V0,R0,R0
BNE	A0,T6,80AA462C
NOP
JR	RA
ADDIU	V0,R0,0001
JR	RA
NOP

80AA4634
LBU	V0,0942 (A0)
ADDIU	V0,V0,00C0
ANDI	V0,V0,00FF
JR	RA
NOP

80AA4648
ADDIU	SP,SP,FFA8
SW	S0,0030 (SP)
OR	S0,A0,R0
SW	RA,0034 (SP)
SW	A1,005C (SP)
ADDIU	A0,R0,0021
JAL	8008033C
ADDIU	A1,R0,000A
LH	T6,0940 (S0)
LBU	T8,094D (S0)
LUI	V1,8013
LW	V1,6FB8 (V1)
ADDIU	T7,T6,0001
BEQ	T8,R0,80AA468C
SH	T7,0940 (S0)
ADDIU	T9,R0,0226
SH	T9,0000 (V0)
LH	A0,0940 (S0)
ADDIU	T3,R0,0078
SLTI	AT,A0,0960
BNEL	AT,R0,80AA46C8
LUI	AT,0001
LBU	T0,094D (S0)
BEQ	T0,R0,80AA46BC
NOP
LHU	T1,0002 (V0)
ORI	T2,T1,2000
SH	T2,0002 (V0)
SB	R0,094D (S0)
BEQ	R0,R0,80AA4780
SH	T3,0000 (V0)
LUI	AT,0001
ORI	AT,AT,23CC
SLT	AT,V1,AT
BNE	AT,R0,80AA4780
LUI	AT,0001
ORI	AT,AT,2625
SLT	AT,V1,AT
BEQL	AT,R0,80AA4784
LW	RA,0034 (SP)
LBU	T4,094D (S0)
SLTI	AT,A0,0808
BNEL	T4,R0,80AA4784
LW	RA,0034 (SP)
BNE	AT,R0,80AA4780
SLTI	AT,A0,0712
BEQL	AT,R0,80AA4784
LW	RA,0034 (SP)
LW	T6,0028 (S0)
ADDIU	A0,SP,0048
ADDIU	A1,SP,0044
SW	T6,0008 (SP)
LW	A3,002C (S0)
LW	A2,0008 (SP)
SW	A3,000C (SP)
LW	T6,0030 (S0)
JAL	800885A8
SW	T6,0010 (SP)
LW	A0,005C (SP)
ADDIU	T7,R0,FFFF
SW	T7,0010 (SP)
ADDIU	V1,A0,00E4
LB	T8,0000 (V1)
LW	T0,0048 (SP)
LW	T1,0044 (SP)
SW	T8,0014 (SP)
LB	T9,0001 (V1)
LUI	T2,8013
LW	T2,6EEC (T2)
SW	T0,001C (SP)
SW	T1,0020 (SP)
SW	T9,0018 (SP)
LW	T9,0000 (T2)
ORI	A1,R0,D06B
ADDIU	A2,R0,FFFF
JALR	RA,T9
ADDIU	A3,R0,FFFF
SB	V0,094D (S0)
LW	RA,0034 (SP)
LW	S0,0030 (SP)
ADDIU	SP,SP,0058
JR	RA
NOP

80AA4794	copy song A1's name to variable text slot A0
	accepts: A0=slot#, A1=song#
ADDIU	SP,SP,FFD8
SW	RA,0014 (SP)
SW	A0,0028 (SP)	;SP+28=A0: slot#
SW	A1,002C (SP)	;SP+2C=A1: song#
JAL	8009D1F0	;V0=p->text controller
NOP
LBU	A1,002F (SP)	;A1=song#
SW	V0,0018 (SP)	;SP+18=V0: p->text controller
ADDIU	A0,SP,001C	;A0=SP+1C: p->buffer
ADDIU	A1,A1,2A00	;A1+=2A00: song->music ID
JAL	80096740	;copy item A1's name to A0
ANDI	A1,A1,FFFF	;A1->short
LW	A0,0018 (SP)	;A0=p->text controller
LW	A1,0028 (SP)	;A1=slot#
ADDIU	A2,SP,001C	;A2=p->name
JAL	8009D88C	;copy A3 bytes from A2 to slot A1 of text controller A0
ADDIU	A3,R0,000A	;A3=strlen A
LW	RA,0014 (SP)
ADDIU	SP,SP,0028
JR	RA
NOP

80AA47E8	copy song request to slot 0
ADDIU	SP,SP,FFE0
SW	RA,0014 (SP)
ADDIU	A0,R0,0021	;A0=21: 
JAL	8008033C	;V0=p->entered.data
ADDIU	A1,R0,000A	;A1=strlen A
JAL	8009D1F0	;V0=p->text controller
SW	V0,001C (SP)	;SP+1C=V0: p->entered.data
LW	A2,001C (SP)	;A2=SP+1C: p->entered.data
OR	A0,V0,R0	;A0=V0: p->text controller
OR	A1,R0,R0	;A1=0: slot 0
ADDIU	A3,R0,000A	;A3=strlen A
JAL	8009D88C	;copy A3 bytes from A2 to slot A1 of text controller A0
ADDIU	A2,A2,0004	;A2+=4: p->string
LW	RA,0014 (SP)
ADDIU	SP,SP,0020
JR	RA
NOP

80AA482C	V0=#songs you haven't heard yet
LUI	V0,8013
LW	V0,6FD8 (V0)	;V0=80136FD8: p->playerdata
ADDIU	V1,R0,2A00	;V1=2A00: base value for music IDs
OR	A0,R0,R0	;A0=0	init.count
OR	A1,R0,R0	;A1=0	init.count.bank
ADDIU	T2,R0,0002
ADDIU	T1,R0,0020
ADDIU	V0,V0,0AC4	;V0=playerdata+AC4: 
//80AA484C:	test which bits are set
SLTI	AT,V1,2A34	;TRUE if valid music ID
ADDIU	A2,R0,0001
BEQ	AT,R0,80AA4890	;branch if invalid ID
OR	A3,R0,R0	;A3=0	init.count.bits
SLL	T6,A1,0x2	;T6=count.bank->offset
ADDU	T7,V0,T6
LW	T0,0000 (T7)	;T0=playerdata+AC4+offset: 
AND	T8,T0,A2
//80AA486C:	neglect count if bit set
BNE	T8,R0,80AA4878	;branch if 1 set in field
SLL	A2,A2,0x1	;A2*=2: next bitmask
ADDIU	A0,A0,0001	;A0++
//80AA4878:
ADDIU	V1,V1,0001	;V1=ID+1
SLTI	AT,V1,2A34
BEQ	AT,R0,80AA4890	;branch if invalid ID
ADDIU	A3,A3,0001	;A3++	count.bits++
BNEL	A3,T1,80AA486C	;loop until 32 bits tested
AND	T8,T0,A2
//80AA4890:	loop through entire bitfield
ADDIU	A1,A1,0001	;A1++	count.bank
BNEL	A1,T2,80AA4850
SLTI	AT,V1,2A34
OR	V0,A0,R0	;V0=A0: count
JR	RA
NOP

80AA48A8	V0=random unheard song
ADDIU	SP,SP,FFD0
SW	RA,0014 (SP)
JAL	80AA482C	;V0=#songs you haven't heard yet
NOP
LUI	A0,8013
ADDIU	A0,A0,6EA0	;A0=80136EA0: runtime variables
LW	V1,0138 (A0)	;V1=runtime+138: p->playerdata
OR	A1,V0,R0	;A1=V0: #songs lacking
BNE	V0,R0,80AA48E0	;branch if you haven't heard them all yet
ADDIU	T2,V1,0AC4	;T2=playerdata+AC4: p->song registers
SW	R0,0AC4 (V1)	;0->playerdata+AC4: reset song register 1
LW	T6,0138 (A0)
ADDIU	A1,R0,0034	;A1=34: max songs
SW	R0,0AC8 (T6)	;0->playerdata+AC8: reset song register 2
//80AA48E0:	grab a random value within available song range
SW	A1,002C (SP)	;SP+2C=A1: #songs lacking
JAL	8002C9AC	;F0=random number (0-1.0)
SW	T2,0018 (SP)	;SP+18=T2: p->song registers
LW	A1,002C (SP)	;A1=#songs lacking
LW	T2,0018 (SP)	;T2=p->song registers
ADDIU	A0,R0,2A00	;A0=2A00: base music item ID
MTC1	A1,F4
OR	T0,R0,R0	;T0=0	init.count.bank
ADDIU	T1,R0,0002
CVT.S.W	F6,F4	;F6=(float) #songs lacking
ADDIU	A3,R0,0020
LW	RA,0014 (SP)
MUL.S	F8,F0,F6	;F8=#songs*rand: random value within range
TRUNC.W.S	F10,F8
MFC1	A1,F10		;A1=random value within song range
NOP
//80AA4920:	get ID of nth available song
SLTI	AT,A0,2A34
ADDIU	V0,R0,0001	;V0=bitflag sample
BEQ	AT,R0,80AA4980	;branch if not within valid range
OR	V1,R0,R0	;V1=0	init.count
SLL	T8,T0,0x2	;T8=count.bank->offset
ADDU	T9,T2,T8	;T9=p->song register+offset: p->song.reg.cur
LW	A2,0000 (T9)	;A2=song.reg.cur
//80AA493C:	use mask to test if heard yet
AND	T3,A2,V0	;T3=nonzero if song's flag set in song.reg.cur
BNE	T3,R0,80AA4968	;skip it on a miss
SLL	V0,V0,0x1	;V0*=2: move mask to next bit
BLEZL	A1,80AA495C
SLL	T4,T0,0x5
BEQ	R0,R0,80AA4968	;branch and decrement random value
ADDIU	A1,A1,FFFF
//80AA4958:	return song#
SLL	T4,T0,0x5	;T4=bank*20: base value for bank
ADDU	V0,T4,V1	;V0=bank.offset+count
BEQ	R0,R0,80AA4990	;return V0=song# (0-33)
ANDI	V0,V0,00FF
//80AA4968:	loop until out of songs
ADDIU	A0,A0,0001	;A0++	ID++
SLTI	AT,A0,2A34
BEQ	AT,R0,80AA4980	;branch if not within valid range
ADDIU	V1,V1,0001	;V1++	count++
BNEL	V1,A3,80AA4940	;loop for 32 bits
AND	T3,A2,V0
//80AA4980:	loop through two banks
ADDIU	T0,T0,0001	;T0++	next bank
BNEL	T0,T1,80AA4924	;try again in bank 2
SLTI	AT,A0,2A34
OR	V0,R0,R0	;V0=0	bad results are bad
//80AA4990:	return
JR	RA
ADDIU	SP,SP,0030

80AA4998	set song A0 as heard
	accepts: A0=song# (0-33)
SLTIU	AT,A0,0034
BEQ	AT,R0,80AA49E4	;return if not a valid song#
LUI	V0,8013
LW	V0,6FD8 (V0)	;V0=80136FD8: p->playerdata
SLTIU	AT,A0,0020
BEQ	AT,R0,80AA49CC	;branch if song in bank 2
ADDIU	V0,V0,0AC4	;V0+=AC4: p->song registers
LW	T6,0000 (V0)	;T6=song.reg.1
ADDIU	T7,R0,0001
SLLV	T8,T7,A0	;T2=1<<bit#: mask for bit
OR	T9,T6,T8	;T9=song.reg.1 | bit: set as heard
JR	RA
SW	T9,0000 (V0)	;update song.reg.1
//80AA49CC:	register 2
LW	T0,0004 (V0)	;T0=song.reg.2
ADDIU	A0,A0,FFE0	;A0-=20: song#->bit# in this bank
ADDIU	T1,R0,0001
SLLV	T2,T1,A0	;T2=1<<bit#: mask for bit
OR	T3,T0,T2	;T3=song.reg.2 | bit: set as heard
SW	T3,0004 (V0)	;update song.reg.2
//80AA49E4:	return
JR	RA
NOP

80AA49EC	nothing much: A0->SP+0, A1->SP+4
SW	A0,0000 (SP)
SW	A1,0004 (SP)
JR	RA
NOP

80AA49FC	nothing much: A0->SP+0, A1->SP+4
SW	A0,0000 (SP)
SW	A1,0004 (SP)
JR	RA
NOP

80AA4A0C
	accepts: A0=p->???, A1=
SLL	T6,A1,0x2	;T6=A1->offset
LUI	T7,80AA
ADDU	T7,T7,T6
LW	T7,4D98 (T7)	;T7=80AA4D98+offset: 
SW	A1,02B4 (A0)
SW	T7,02A0 (A0)
JR	RA
NOP

80AA4A2C	JAL to @(A0+2A0)
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
LW	T9,02A0 (A0)
JALR	RA,T9
NOP
LW	RA,0014 (SP)
ADDIU	SP,SP,0018
JR	RA
NOP

80AA4A50
ADDIU	SP,SP,FFE0
SW	RA,001C (SP)
SW	A0,0020 (SP)
SW	A1,0024 (SP)
LW	T6,0020 (SP)
ORI	A0,R0,F108
LW	T8,000C (T6)
SW	T8,0004 (SP)
LW	A2,0010 (T6)
LW	A1,0004 (SP)
SW	A2,0008 (SP)
LW	A3,0014 (T6)
SW	R0,0010 (SP)
JAL	8008AA24
SW	A3,000C (SP)
LW	A0,0020 (SP)
JAL	80AA4A2C	;JAL to @(A0+2A0)
LW	A1,0024 (SP)
LW	T0,0020 (SP)
LUI	T9,80AA
ADDIU	T9,T9,4A2C
SW	T9,0164 (T0)
LW	RA,001C (SP)
ADDIU	SP,SP,0020
JR	RA
NOP

80AA4AB8
ADDIU	SP,SP,FFD8
SW	RA,0014 (SP)
OR	A3,A0,R0
LW	A2,0000 (A3)
ADDIU	A0,R0,0021
ADDIU	A1,R0,000A
JAL	8008033C
SW	A2,0024 (SP)
LW	A2,0024 (SP)
BEQ	V0,R0,80AA4BF4
SW	V0,0020 (SP)
LBU	T6,000F (V0)
LUI	T7,8013
BEQL	T6,R0,80AA4BF8
LW	RA,0014 (SP)
LW	T7,6F38 (T7)
SW	A2,0024 (SP)
ADDIU	A0,R0,002B
LW	T9,00AC (T7)
JALR	RA,T9
NOP
LW	A0,0024 (SP)
SW	V0,001C (SP)
JAL	80090F10
ADDIU	A1,R0,0001
LW	A2,0024 (SP)
LW	V0,02B8 (A2)
LUI	T0,DB06
ORI	T0,T0,0018
ADDIU	T8,V0,0008
SW	T8,02B8 (A2)
SW	T0,0000 (V0)
LW	T1,001C (SP)
LUI	T7,0600
OR	A0,A2,R0
SW	T1,0004 (V0)
LW	V0,02B8 (A2)
LUI	T3,E800
LUI	T1,DE00
ADDIU	T2,V0,0008
SW	T2,02B8 (A2)
SW	R0,0004 (V0)
SW	T3,0000 (V0)
LW	V0,02B8 (A2)
LUI	T5,FA00
ORI	T5,T5,0080
ADDIU	T4,V0,0008
SW	T4,02B8 (A2)
SW	T5,0000 (V0)
LW	T6,0020 (SP)
ADDIU	AT,R0,FF00
LUI	T4,0100
LBU	T9,000F (T6)
ORI	T4,T4,4008
OR	T8,T9,AT
SW	T8,0004 (V0)
LW	V0,02B8 (A2)
LUI	T2,0602
ADDIU	T2,T2,1E60
ADDIU	T0,V0,0008
SW	T0,02B8 (A2)
SW	T2,0004 (V0)
SW	T1,0000 (V0)
LW	V0,02B8 (A2)
LUI	T5,80AA
ADDIU	T5,T5,4DA0
ADDIU	T3,V0,0008
SW	T3,02B8 (A2)
SW	T5,0004 (V0)
SW	T4,0000 (V0)
LW	V0,02B8 (A2)
ORI	T7,T7,0204
ADDIU	T9,R0,0406
ADDIU	T6,V0,0008
SW	T6,02B8 (A2)
SW	T9,0004 (V0)
SW	T7,0000 (V0)
JAL	8009104C
ADDIU	A1,R0,0001
LW	RA,0014 (SP)
ADDIU	SP,SP,0028
JR	RA
NOP

80AA4C04
ADDIU	SP,SP,FFD8
SW	RA,0014 (SP)
SW	A0,0028 (SP)
SW	A1,002C (SP)
LW	T6,002C (SP)
LUI	T8,8013
LW	T8,6F38 (T8)
LW	T7,0000 (T6)
ADDIU	A0,R0,002B
SW	T7,0024 (SP)
LW	T9,00AC (T8)
JALR	RA,T9
NOP
LUI	T0,8013
LW	T0,6F38 (T0)
SW	V0,0020 (SP)
ADDIU	A0,R0,0058
LW	T9,0450 (T0)
JALR	RA,T9
NOP
SW	V0,001C (SP)
JAL	800E13C4
LW	A0,0024 (SP)
BEQ	V0,R0,80AA4D00
LW	A0,0024 (SP)
JAL	800BD5E8
SW	V0,0018 (SP)
LW	A1,0018 (SP)
LW	T1,0024 (SP)
LUI	T2,DA38
ORI	T2,T2,0003
LW	V0,0298 (T1)
OR	V1,V0,R0
SW	T2,0000 (V1)
SW	A1,0004 (V1)
ADDIU	V0,V0,0008
LUI	T3,DB06
ORI	T3,T3,0020
OR	V1,V0,R0
SW	T3,0000 (V1)
LW	T4,001C (SP)
ADDIU	V0,V0,0008
LUI	AT,8000
SW	T4,0004 (V1)
LW	A0,0020 (SP)
ADDU	T5,A0,AT
LUI	AT,8014
SW	T5,58B8 (AT)
OR	V1,V0,R0
LUI	T6,DB06
ORI	T6,T6,0018
SW	T6,0000 (V1)
SW	A0,0004 (V1)
ADDIU	V0,V0,0008
OR	V1,V0,R0
LUI	T8,0602
ADDIU	T8,T8,11A8
LUI	T7,DE00
SW	T7,0000 (V1)
SW	T8,0004 (V1)
ADDIU	V0,V0,0008
LW	T0,0024 (SP)
SW	V0,0298 (T0)
JAL	80AA4AB8
LW	A0,002C (SP)
LW	RA,0014 (SP)
ADDIU	SP,SP,0028
JR	RA
NOP

80AA4D18	nothing much: A0->SP+0, A1->SP+4
SW	A0,0000 (SP)
SW	A1,0004 (SP)
JR	RA
NOP
